package com.yiwenup.common.basic.template;

import com.yiwenup.common.basic.BaseRequestDTO;
import com.yiwenup.common.basic.BaseResponseDTO;

/**
 * 抽象业务模版
 **/
public abstract class AbstractExecutor<Req extends BaseRequestDTO, Resp extends BaseResponseDTO<Data>, Data> implements Executor<Req, Resp, Data> {

    /**
     * 业务校验
     */
    protected abstract void check(Req request);

    /**
     * 业务处理
     */
    protected abstract Resp handle(Req request);

    @Override
    public Resp execute(Req req) {
        check(req);
        return handle(req);
    }
}
